Skip to main content

Http2

https://cabulous.medium.com/http-2-and-how-it-works-9f645458e4b2

Some of the benefits of gRPC can be attributed to the robust capabilities of HTTP/2, which set it apart from HTTP/1. The latest version of HTTP/1 is HTTP/1.1, which has been around for 15 years but sometime is not suitable for the growing needs of today’s Web. The main goal of HTTP/2 is to increase the performance and robustness of the HTTP network protocol by reducing the processing latency of HTTP requests with new strategies for delivering data between a client and a server, such as:

  • Multiplexing
  • Compression and binary data transport
  • Flow control
  • Server push

Multiplexing

Multiplexing is a new strategy for dialogue between a server and a client. With the same connection between the client and the server, the client cans end several requests to the server. It’s much more efficient than opening a connection for each request, as HTTP/1 does. You certainly want to save load on your server, so that’s a great feature of HTTP/2. gRPC streaming requests are based on this.

Http1 vs http2

Compression and Binary Data Transport

HTTP/2 allows data transport in binary and incidentally allows efficient compression (repeated strings of bytes offer remarkable compression efficiency). This is reflected in performance:

  • Network latency is reduced because the data is less voluminous.
  • Network traffic is reduced and allows better use of the network. As we have already seen, gRPC is also based on this principle. In HTTP/2, headers can be compressed with the HPACK specification. This specification is described in the RFC 7541 standard (https://tools.ietf.org/html/ rfc7541).